package com.zero;

public class Main {

    public static void main(String[] args) {
	// write your code here
        /**
         * if 语句
         */
        int age = 50;
        if (age > 18) {
            System.out.println("够年龄了，可以浏览一下哦~");
        }else {
            System.out.println("太小了，找家长陪同哦~");
        }

        /**
         * switch语句
         */
        char grade = 'C';

        switch(grade) {
            case 'A' :
                System.out.println("优秀");
                break;
            case 'B' :
            case 'C' :
                System.out.println("良好");
                break;
            case 'D' :
                System.out.println("及格");
            case 'F' :
                System.out.println("你需要再努力努力");
                break;
            default :
                System.out.println("未知等级");
        }
        System.out.println("你的等级是 " + grade);

        /**
         * for 循环
         */
        for (int i = 0; i < 10; i++) {
            System.out.println("Hello world:" + i);
        }

        String inputString = "Hello World";
        for (char c :
                inputString.toCharArray()) {
            System.out.println("字符：" + Character.toString(c));

        }

        /**
         * while 循环
         */
        int a = 0;
        while (a < 10) {
            System.out.println("人家还小哦~：" + a);
            a++;
        }
        do {
            System.out.println("大熊，长大了哦~");
            a++;
        }while (a == 10);

        for (int i = 0; i < 6; i++) {
            for (int j = 0; j < i+1; j++) {
                System.out.print(" * ");
            }
            System.out.println();
        }
        for (int i = 0; i < 7; i++) {
            for (int j = 0; j < 7-i; j++) {
                System.out.print(" * ");
            }
            System.out.println();
        }

        for (int i = 1; i < 6; i++) {
            for (int j = 1; j < 6-i; j++) {
                System.out.print("   ");
            }
            for (int j = 1; j <= 2*i-1; j++) {
                System.out.print(" * ");
            }
            System.out.println();
        }

        for (int i = 1; i < 8; i++) {
            for (int j = 1; j < 8; j++) {
                if (i == 1 || i == 7) {
                    if (j == 4) {
                        System.out.print(" * ");
                    }else  {
                        System.out.print("   ");
                    }
                }else  {
//                    System.out.println(i % 4);
                    if (i % 4 == 0) {
                        if (j == 1|| j==7) {
                            System.out.print(" * ");
                        }else  {
                            System.out.print("   ");
                        }
                    }else if (i % 4 == 1||i % 4 == 3) {
                        if (j == 2|| j==6) {
                            System.out.print(" * ");
                        }else  {
                            System.out.print("   ");
                        }
                    }else  if (i % 4 == 2) {
                        if (j == 3|| j==5) {
                            System.out.print(" * ");
                        }else  {
                            System.out.print("   ");
                        }
                    }
                }
            }
            System.out.println();
        }


    }
}
